package qp.src.app.server;

import java.util.Date;

public class DataBean {

  private Integer id;
  private Integer version;
  private String name;
  private String lastName;
  private String address;
  private Date dateTime;

  private SubDataBean data;

  //-----------------------------------------------


  public Integer getId() {
    return id;
  }
  public SubDataBean getData() {
    return data;
  }
  public void setData(SubDataBean data) {
    this.data = data;
  }
  public void setId(Integer id) {
    this.id = id;
  }
  public Integer getVersion() {
    return version;
  }
  public void setVersion(Integer version) {
    this.version = version;
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public String getLastName() {
    return lastName;
  }
  public void setLastName(String lastName) {
    this.lastName = lastName;
  }
  public String getAddress() {
    return address;
  }
  public void setAddress(String address) {
    this.address = address;
  }
  public Date getDateTime() {
    return dateTime;
  }
  public void setDateTime(Date dateTime) {
    this.dateTime = dateTime;
  }

  //-----------------------------------------------

  public static DataBean findDataBean(Integer id) {
    System.out.println("--Server DataBean findDataBean");
    return EntityService.findDataBean(id);
  }

//  public void delete(){
//    System.out.println("--Server DataBean start delete");
//    if( this != null ){
//      Integer dataBeanId = this.getId();
//      Integer subDataBeanId = this.getData().getId();
//      EntityService.delete( dataBeanId,  subDataBeanId );
//    }
//    System.out.println("--Server DataBean end delete");
//  }
//
//  public void persist(){
//    EntityService.persist( this );
//  }

  public void copyFrom(DataBean dataBean) {
    id = dataBean.getId();
    version = dataBean.getVersion();
    name = dataBean.getName();
    lastName = dataBean.getLastName();
    address = dataBean.getAddress();
    dateTime = dataBean.getDateTime();
    data = dataBean.getData();
  }

}
